TEX = tex
INCLUDE = include
SRCCODE = codepic/code
SRCPIC	= codepic/pic
SRCDIA	= pictures

SYSA_BIN = ../../bin
TESTS_SRC = ../../src/sys/tests
TESTS_BIN = ../../bin/sys/tests

PDF=test.pdf
S2L=./src2tex
D2T=dot2tex -f tikz  --figonly
PDFLATEX = pdflatex -interaction=nonstopmode

.PHONY: clean proposal
proposal: $(PDF)

# Перевод исходных файлов в теховский формат
#$(INCLUDE)/%.java.tex: $(SRCCODE)/%.java
	#$(S2L) $< >  $@	

## епс в пдф
#$(INCLUDE)/%_dia_eps.pdf: $(SRCPIC)/%_dia.eps
	#epstopdf $< --outfile=$@

# епс в пнг
$(INCLUDE)/%.png: $(SRCUML)/%.eps
	epstopdf $< --outfile=$@

# Получение епс из диа
$(SRCPIC)/%_dia.eps:$(SRCDIA)/%.dia 
	dia -e $@ -t eps-pango $<

# gv в tex
$(INCLUDE)/%.gv.tex: $(SRCDIA)/%.gv
	$(D2T) $<  > $@

# Листинги тестов
$(INCLUDE)/test/%.test.tex: $(TESTS_BIN)/%.test
	$(S2L) $< >  $@	

$(INCLUDE)/test/%.java.tex: $(TESTS_SRC)/%.java
	$(S2L) $< >  $@	

# Картинки из диа в пдф
$(INCLUDE)/%_dia_eps.pdf: $(INCLUDE)/%_dia.eps
	epstopdf $< --outfile=$@

$(INCLUDE)/%_dia.eps:$(SYSA_BIN)/%.dia 
	dia -e $@ -t eps-pango $<

$(PDF) : $(addprefix $(TEX)/, test.tex) $(addprefix $(INCLUDE)/, test/automat/result.test.tex test/automat/AutomatTest.java.tex test/logic/result.test.tex test/logic/LogicTest.java.tex sys/fsm/graph/Automat_sm_dia_eps.pdf) 

	cd $(TEX) && $(PDFLATEX) test.tex && cp $(PDF) ..

clean:
	rm $(INCLUDE)/* ; find $(TEX)/ -type f ! -name "*.tex" -exec rm -f {} \;
